﻿using MediatR;
using T.Settlement.API.Application.Command.ExpensesCommand;
using T.Settlement.Repository.SettlementInterface;

namespace T.Settlement.API.Application.CommandHandlers.ExpensesHandler
{
    public class ExpensesCheckCommandHandler : IRequestHandler<ExpensesCheckCommand, int>
    {
        private readonly IExpensesSRepository _repository;
        /// <summary>
        /// 构造函数注入
        /// </summary>
        /// <param name="repository"></param>
        public ExpensesCheckCommandHandler(IExpensesSRepository repository)
        {
            _repository = repository;
        }
        public async Task<int> Handle(ExpensesCheckCommand request, CancellationToken cancellationToken)
        {
            request.CheckStatus = true;
            request.CheckDate = DateTime.Now;
            request.CheckPeople = "王总";
            return await _repository.Update(request);
        }
    }
}
